CHARTS
Photo by Tomas Williams on Unsplash
Sometimes, the world from above seems too beautiful, too wonderful, too distant for human eyes to see….
— Charles A. Lindbergh
# Create dataset
df = read.csv("archetypes/airline-passenger-traffic/projected-growth-in-airline-passenger-traffic-by-region.csv", header = TRUE)
# Prepare the data
df$xmax <- cumsum(df$RPK)
df$xmin <- df$xmax - df$RPK
df$xlabel <- (df$xmax + df$xmin)/2
df$label <- paste(as.character(df$Growth),"%")
data<-df %>% rename(Regions=Region)
data
theme_opts <- theme(
legend.position = "none",
legend.title = element_blank(),
axis.text = element_blank(),
axis.line = element_blank(),
axis.ticks = element_blank(),
axis.title = element_blank(),
panel.grid = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background=element_rect(fill="white", colour="white"),
panel.border = element_blank(),
plot.background = element_blank(),
plot.margin = unit(c(0, 0, 1.25, 0), "in")
)
v1 <- ggplot(data) +
geom_rect(aes(ymin = 0, ymax = Growth, xmin = xmin, xmax = xmax, fill = Regions), color = "white", alpha = 0.5 ) +
geom_text(aes(x = xlabel, y = Growth, label = label, vjust = -1), position = "identity", color = "black", size = 3 ) +
geom_text(aes(x = xlabel, y = 0.2, label = format(RPK, big.mark = ",", scientific = FALSE), vjust = 0), position = "identity", color = "black", size = 3 ) +
geom_text(aes(x = 9500, y = 0.2, label = "Estimated\nRPK (B)\nin 2035"), vjust = 0.4) +
geom_text(aes(x = xlabel, y = 0, label = Regions), hjust = "right", vjust = 1.5, position = "identity", color = "black", size = 3.5, angle = 45 ) +
geom_hline(yintercept = 4.8, linetype = "dashed") + geom_text(aes(0, 4.8, label = "World Traffic\nGrowth 4.8%")) +
geom_hline(yintercept = 2.9, linetype = "dashed") + geom_text(aes(0, 2.9, label = "World GDP\nGrowth 2.9%")) +
coord_cartesian(clip="off") +
theme(plot.title = element_text(size = rel(1.5)), panel.background = element_rect(fill = "white", colour = "grey50")) +
theme_opts +
labs(title = "Projected Annual Growth in Revenue Passenger Kilometers (RPK) 2015-2035 (top 10 regional flows)")
girafe(ggobj = v1, width_svg = 16, height_svg = 9,
options = list(opts_sizing(rescale = TRUE, width = 1.0)))
The citations and data sources used for this case is available at the source: Projected growth in airline passenger traffic by region